#include <bits/stdc++.h>

using namespace std;
const int MAXNUM = 100000008;
const int MOD = 100000;
const int FILENUMS = 60;
const int GROUPNUM = 60;
const int SIZE = MAXNUM / GROUPNUM + 1;
int main() {
    unsigned long long *arr = new unsigned long long[SIZE];
    memset(arr, 0, sizeof(unsigned long long) * SIZE);
    int maxnum = 0;
    for (int idx = 1; idx <= FILENUMS; idx++) {
        fstream inputfile(to_string(idx) + ".txt");
        int num;
        while (!inputfile.eof()) {
            inputfile >> num;
            maxnum = max(maxnum, num);
            arr[num / GROUPNUM] |= (1ULL << (num % GROUPNUM));
        }
        inputfile.close();
    }
    int cnt = 0;
    int c = 0;
    for (int i = 0; i <= maxnum; i++) {
        if (arr[i / GROUPNUM] & (1ULL << i % GROUPNUM)) {
            if ((++cnt) % MOD == 0) {
                cnt = 0;
                cout << i << endl;
                if ((++c) >= 10)
                    break;
            }
        }
    }
    // system("pause");
    return 0;
}
